import { ModelServiceStore } from './core';
import { IPSModelObject } from './ipsmodel-object';
import { IPSModelService } from './ipsmodel-service';
import { IPSModelServiceProxy } from './ipsmodel-service-proxy';

export class PSModelServiceProxyImpl implements IPSModelServiceProxy {
  /**
   * 原本模型服务
   *
   * @author chitanda
   * @date 2021-12-26 16:12:05
   * @protected
   * @type {IPSModelService}
   */
  protected iPSModelService!: IPSModelService;

  protected tag: any = null;

  get store(): ModelServiceStore {
    return this.getStore();
  }

  init(iPSModelService: IPSModelService, tag: any): void {
    this.iPSModelService = iPSModelService;
    this.tag = tag;
  }

  getRealPSModelService(): IPSModelService {
    return this.iPSModelService;
  }

  getModel(relatedPSModelObject: IPSModelObject, filePath: string) {
    return this.getRealPSModelService().getModel(relatedPSModelObject, filePath);
  }

  getPSModel4(relatedPSModelObject: IPSModelObject, cls: string, objNode: any, strTag: string): IPSModelObject {
    return this.getRealPSModelService().getPSModel4(relatedPSModelObject, cls, objNode, strTag);
  }

  getPSModel5(relatedPSModelObject: IPSModelObject, cls: string, list: any[], objKey: any): IPSModelObject {
    return this.getRealPSModelService().getPSModel5(relatedPSModelObject, cls, list, objKey);
  }

  getRealObjectNode(obj: IModel): IModel {
    return this.getRealPSModelService().getRealObjectNode(obj);
  }

  getStore(): ModelServiceStore {
    return this.getRealPSModelService().getStore();
  }

  getChildPSModelObject(relatedPSModelObject: IPSModelObject, cls: string, objNode: IModel): IPSModelObject {
    return this.getRealPSModelService().getChildPSModelObject(relatedPSModelObject, cls, objNode);
  }

  getParentPSModelObject(relatedPSModelObject: IPSModelObject, cls: string): IPSModelObject {
    return this.getRealPSModelService().getParentPSModelObject(relatedPSModelObject, cls);
  }

  getRootModel(): IPSModelObject {
    return this.getRealPSModelService().getRootModel();
  }
}
